package com.sinopac.util;

import java.io.File;

import org.apache.struts2.ServletActionContext;

public class FileUploadUtil {
	/**
	 * 取得war檔root上傳路徑
	 * @param uploadFileName
	 * @return
	 */
	public static File getUploadUrl(String uploadFileName){
		String path = "";
		if(uploadFileName.toLowerCase().indexOf(".xml")>0){
			path = "/xml";
		}else{
			path = "/csv";
		}
		File file = new File(ServletActionContext.getServletContext()
				.getRealPath("/upload"+path)+"//"+uploadFileName);
		return file;
	}
}
